<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>youban资源筛选</title>
<meta content="" name="description">
<script type="text/javascript" src="/j-tool/jquery.js"></script>
<style>
	.cright ul{height:20px;line-height:20px;}
	.cright ul li{display:inline;float:left;overflow:hidden;}
	.w50{width:50px;text-align:center;}
	.w150{width:150px;}
	.w100{width:150px;}
	.w190{width:180px;}
	#clist ul li{font-size:14px;}
	.i-text{width:195px;height:20px;line-height:20px;}
	.butt{height:27px; width:80px;}
	.select{padding-top: 15px;padding-left: 50px; padding-bottom: 10px;border-bottom:1px solid gray;}
	.top{text-align:center;padding-bottom: 7px;border-bottom:1px solid gray;}
</style>
<body>
	<div class="top"><a href="/youban.php">资源筛选<a>&nbsp;&nbsp;&nbsp;<a href="javascript:;" onclick="putout();">资源打印(<!--{$ch}-->)<a></div>
	<div class="select">
		<form action="" method="post" name="form1" onsubmit="return false;">
			<table>
				<tr><td width="60px;">资源:</td><td><input type="text" name="name" class="i-text"/></td></tr>
				<tr><td>分类:</td><td><input type="text" name="cate" class="i-text"/></td></tr>
				<tr><td></td><td><input type="submit" value="查找" class="butt" onclick="allsearch();">&nbsp;&nbsp;<a href="javascript:;" onclick="last();">上一页</a>&nbsp;<a href="javascript:;" onclick="next();">下一页</a><td></tr>
			</table>
		</form>
	</div>
	<div class="cright">
		<ul><li class="w50">编号</li><li class="w150">资源</li><li class="w100">分类</li><li class="w190">flash</li><li class="w190">图片</li><li class="w100">操作</li></ul>
		<div id="clist">
			<!--{foreach from=$list item=val key=key}-->
			<ul id="l<!--{$val.id}-->">
				<li class="w50"><!--{$val.id}--></li>
				<li class="w150"><!--{$val.Fname}--></li>
				<li class="w100"><!--{$val.Fdesc}--></li>
				<li class="w190"><a href="/source/station/<!--{$val.Fswffile}-->" target="_blank"><!--{$val.Fswffile}--></a></li>
				<li class="w190"><a href="/source/station/<!--{$val.Fimgfile}-->" target="_blank"><!--{$val.Fimgfile}--></a></li>
				<li class="w100"><a href="javascript:;" onclick='dealWith(<!--{$val.id}-->);'>入库</a></li>
			</ul>
			<!--{/foreach}-->
		</div>
	</div>
</body>
<script>
	var pg = 1;
	function last()
	{
		pg>1?pg--:"";
		search();
	}
	function next()
	{
		pg++;
		search();
	}
	function allsearch()
	{
		pg=1;
		search();
	}
	function dealWith(id)
	{
		$.ajax({
		   type: "POST",
		   url: "/admins/admins_ajax.php",
		   data: 'action=dyouban&id='+id,
		   success: function(msg){
				msg == 'OK'?$('#l'+id).detach():alert(msg);				
		   }
		});
	}

	function search()
	{
		$.ajax({
		   type: "POST",
		   url: "/admins/admins_ajax.php",
		   data: 'action=youban&page='+pg+'&'+$("form").serialize(),
		   success: function(msg){
				if(msg !='null')
				{
					var data = $.parseJSON(msg),html='';
					for(var i=0;i<data.length;i++)
					{
						html += "<ul id='l"+data[i].id+"'><li class='w50'>"+data[i].id+"</li><li class='w150'>"+data[i].Fname+"</li><li class='w100'>"+data[i].Fdesc+"</li><li class='w190'><a href='/source/station/"+data[i].Fswffile+"' target='_blank'>"+data[i].Fswffile+"</a></li><li class='w190'><a href='/source/station/"+data[i].Fimgfile+"' target='_blank'>"+data[i].Fimgfile+"</a></li><li class='w100'><a href='javascript:;' onclick='dealWith("+data[i].id+");'>入库</a></li></ul>"
					}
					$('#clist').html(html);
				}else{
					alert('没有找到相关数据');
				}			
		   }
		});
	}

	function putout()
	{
		$.ajax({
		   type: "POST",
		   url: "/admins/admins_ajax.php",
		   data: 'action=myouban',
		   success: function(msg){alert(msg);}
		});
	}
</script>
</html>